<template>
  <div>
    <Header></Header>
    <div class="tabs">
      <ul>
        <li><router-link to="/goods">商品</router-link></li>
        <li><router-link to="/rating">评价</router-link></li>
        <li><router-link to="/seller">商家</router-link></li>
      </ul>
      <router-view></router-view>
    </div>

    <div class="carList" v-show="$store.state.show">
      <!-- 购物车页面的遮罩层 -->
      <div class="mask1" v-show="show">
        <div>
            <!-- <div class="gwc">购物车</div> -->
          <ul>
            <div class="gwc">购物车<span class="s1" 
              @click="kong2">清空</span></div>
            <li class="l1" v-for="item in carList" :key="item.name">
          <h4>{{ item.name }}</h4>
          <span>￥{{ item.price * item.count }}</span>
          <Btns class="btn" :item="item"></Btns>
            </li>
          </ul>
          <!-- <Btns class="btn" :item="item"></Btns> -->
        </div>
      </div>

      <!-- 购物车添加的内容 -->
    </div>
  </div>
</template>

<script>
import { mapState,mapMutations } from "vuex";
import Header from "./views/Header.vue";
import Btns from "./views/tabs/btns.vue";
export default {
  components: {
    Header,
    Btns,
  },
  methods: {
    showCar() {
      this.show = !this.show;
    },
    kong2(){
          this.$store.commit("kong");
        }
  },
  computed: {
    ...mapState(["show","carList"]),
  },
  mounteds:{
   

  }
};
</script>

<style lang="less" scoped>
//   position: relative;
.mask1 {
  width: 100%;
  height: 100vh;
  z-index: 1;
    background: rgba(7, 17, 27, 0.6);
//   background-color: red;
  position: absolute;
  bottom: 170px;
  left: 0;
}
.carList {
  position: relative;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  // background: rgba(0, 0, 0, .5);

  ul {
    position: absolute;
    bottom: 50px;
    width: 100%;
    left: 0;
    height: 200px;
    background: white;
    z-index: 2;
  }
  span{
  //   position: absolute;
  //   top: 55px;
  //   right: 130px;
    color: red;
    padding-right: 20px;
    padding-top: 4px;
   }

}

.tabs {
  height: 100%;
  overflow: hidden;
  ul {
    display: flex;
    justify-content: space-around;
    border-bottom: 1px solid rgba(7, 17, 27, 0.1);
    li {
      height: 40px;
      line-height: 40px;
      a {
      }
    }
  }
}
.carList ul li {
  display: flex;
}
h4{
  padding-left: 20px;
  padding-top: 5px;
  flex:1;
  // border-top: 1px solid grey;
}
.btn{
    // position: absolute;
    // top: 50px;
    // right: 20px;
    padding-top: 7px;
  }
  .gwc{
    padding-left: 20px;
    width: 100%;
    height: 40px;
    color: black;
    // background-color: red;
    padding-top: 10px;
    border-bottom: 0.1px solid gray;
    justify-content:space-between;
    .s1{
      color: blue;
      position: absolute;
      right: 10px;
      font-size: 18px;
      color: rgb(0,160,220);
    }
  }
  .l1{
    border-bottom: 0.1px solid gray;
    line-height: 40px;
  }
 
</style>
